package com.ruoyi.common.annotation;

import com.ruoyi.common.validator.CustomValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = CustomValidator.class) // 指定验证器类
public @interface CustomValidation {
    String message() default "自定义验证失败"; // 默认错误信息

    Class<?>[] groups() default {}; // 分组

    Class<? extends Payload>[] payload() default {}; // 负载
}
